type Type = "String" | "Number" | "Array" | "Date" | "Function" | "Null" | "Undefined" | "Object"


export const isType = (data: any): Type => {
  const type = Object.prototype.toString.call(data)
  let typeStr: Type = "String"
  switch (type) {
    case "[object String]":
      return typeStr = "String"
    case "[object Number]":
      return typeStr = "Number"
    case "[object Array]":
      return typeStr = "Array"
    case "[object Date]":
      return typeStr = "Date"
    case "[object Function]":
      return typeStr = "Function"
    case "[object Null]":
      return typeStr = "Null"
    case "[object Undefined]":
      return typeStr = "Undefined"
    case "[object Object]":
      return typeStr = "Object"
  }
  return typeStr
}